<div class="box white_bg">
<?if (!isset($this->viewParams['items'])) :?>
 No <?=$this->viewParams['contentType'] ?> posted yet
<?else:?>
<?
$pageCount = ceil($this->viewParams['paginator']->getTotalItemCount()/$this->viewParams['paginator']->getItemCountPerPage());
?>
<?$sess = new Zend_Session_Namespace(CLU_NS);?>
<?foreach ($this->viewParams['items'] as $i=> $item) :?>
		  <div class="box" style="border-bottom:1px solid #DFDFDF;">
		     <div class="chitiet_title">&nbsp;&nbsp;
		     	<?  if ($this->viewParams['contentType'] == "place" ||
		     				$this->viewParams['contentType'] == "event"  ) 
		     			$link = $this->hvnUrl(array('module' => $this->viewParams['contentType'], 'action' => "view"),"nocontroller") . "?id=" . $item['id'];
		     	    else if ($this->viewParams['contentType'] == "gallery")
		     	    	$link = $this->hvnUrl(array('module' => "gallery", 'action' => "view"),"nocontroller") . "?id=" . $item['id'];
		     	    else
		     	   		$link = $this->hvnUrl(array('type' => $this->viewParams['contentType'], 'action' => "view"),"node") . "?id=" . $item['id'];
			     
		     	    if (isset($this->viewParams["aList"][$item['id']]['article_title']))
		     	    { 
			     		$title = $this->viewParams["aList"][$item['id']]['article_title'];
			     		$body = $this->viewParams["aList"][$item['id']]['article_body'];	
					}
		     	   	else
		     	   	{
		     	   		$title = $item['title'];
		     	   		$body = $item['body'];
		     	   	}
		     	   	//die_a($item);
		     	   	$metadata = unserialize($item['metadata']);
		     	   	if ($this->viewParams['contentType'] == "place")
		     	   	{
		     	   		if (isset($metadata['type_name']))
		     	   			$categoryName = $metadata['type_name'];
		     	   	}  
		     	   	else if ($this->viewParams['contentType'] == "gallery")
		     	   	{
		     	   		if (trim($item['category']) == "-2") //event
		     	   		{
		     	   			$categoryLink = $this->hvnUrl(array('module' => 'event', "action" => "view"), "nocontroller") . "?id=" . $metadata['content_id'];
		     	   			$categoryName = "<a href='" . $categoryLink . "'> " . $metadata['content_title'] . "</a>";
		     	   		}
		     	   		else if ($item['category'] == '-1') //place
		     	   		{
		     	   			$categoryLink = $this->hvnUrl(array('module' => 'place', "action" => "view"), "nocontroller") . "?id=" . $metadata['content_id'];
		     	   			$categoryName = "<a href='" . $categoryLink . "'> " . $metadata['content_title'] . "</a>";

		     	   		}
		     	   		else
		     	   			$categoryName = $this->viewParams['contentType'] ;
		     	   		
		     	   	}
		     	   	else
		     	   	{
		     	   		if (isset($metadata['category_name']))
		     	   			$categoryName = $metadata['category_name'];
		     	   	}
		     	   	if (!isset($categoryName))
		     	   		$categoryName = "No category";
		     	?>
			     <a href="<?= $link?>">
			     <?= ($this->viewParams['paginator']->getCurrentPageNumber() - 1) * $this->viewParams['paginator']->getItemCountPerPage() + $i + 1?>. <?=$title ?>
			     </a>
			 </div>
			<div class="blog_news" align="left">
			<div class="blog_news_left">
				<?=t(136)?>  : 
			 	<a href="<?=$this->hvnUrl(array('action'=>'view'),'account')?>?id=<?=$item['poster_id']?>"> <span><?=$metadata['poster_name']?></span>  </a>
				<?=t(1020)?> 
				<? if (isset($item['created'])) :?>
				<?=date("j/n/Y", $item['created'])?>
				<?else :?>
				<?=date("j/n/Y", $this->viewParams["aList"][$item['id']]['article_post_time'])?>
				<?endif ?>,
				<?=t(827)?> <?=p($categoryName)?> 
			</div>
			<div class="blog_news_right"><?=$item['views'] + 100 ?> <?=t(1019)?> - <?=$item['comments']?> 
			<?=t(601)?><?if($sess->viewLang == 'en' && $item['comments'] > 0) echo 's'?>
			</div>
			<div class="clear"></div>
			</div>
			<div class="clear"></div>
			<div class="news_img">
			<? if (isset($item['thumb'])) :?>
			<img src="<?=str_replace("/original/", "/small/", $item['thumb'])?>" align="absmiddle" />
			<?else :?>
			<img src="/public/themes/prime/images/common/75x75_no_image.gif" align="absmiddle" />
			<?endif?> 
			</div>

			 <div class="text">
			     <?= substring_n_words(strip_tags($body), 100) ;?> ...
			 </div>
			 
			 <div class="detail"><a style="color:#324171;" href="<?=$link?>"><?=t(150)?>...</a></div>
		  </div>
		<script type="text/javascript">
			var oriLang = '<?= get_language_from_int($item['language'])?>';
			var lang = '<?= $sess->viewLang?>';
		    googleTranslate(oriLang, lang, 'chitiet_title', 'text');
		</script>  
<?endforeach ?>
<div>

<? if ($pageCount > 1) :?>
	<?= $this->paginationControl($this->viewParams['paginator'], 'Sliding', '/modules/common/views/scripts/commonTheme/commonLang/common/clu-pagination-control.phtml',
							    array('searchUrl' => $this->viewParams['searchUrl'])); ?>
<?endif ?>
</div>
<?endif ?>
</div>
</div>